use hash_string::hash_string::{string_hash, string_nocase_hash};

#[test]
fn test_string_hash() {
    let test1 = "this is a test";
    let test2 = "this is a tesu";
    let test3 = "this is a test ";
    let test4 = "this is a test";
    let test5 = "This is a test";

    // Contents affect the hash
    assert_ne!(string_hash(test1), string_hash(test2));

    // Length affects the hash
    assert_ne!(string_hash(test1), string_hash(test3));

    // Case sensitive
    assert_ne!(string_hash(test1), string_hash(test5));

    // The same strings give the same hash
    assert_eq!(string_hash(test1), string_hash(test4));
}

#[test]
fn test_string_nocase_hash() {
    let test1 = "this is a test";
    let test2 = "this is a tesu";
    let test3 = "this is a test ";
    let test4 = "this is a test";
    let test5 = "This is a test";

    // Contents affect the hash
    assert_ne!(string_nocase_hash(test1), string_nocase_hash(test2));

    // Length affects the hash
    assert_ne!(string_nocase_hash(test1), string_nocase_hash(test3));

    // Case insensitive
    assert_eq!(string_nocase_hash(test1), string_nocase_hash(test5));

    // The same strings give the same hash
    assert_eq!(string_nocase_hash(test1), string_nocase_hash(test4));
}